# Maintainer: Johannes Löthberg <johannes@kyriasis.com>

pkgname=(python-prometheus_client python2-prometheus_client)
pkgver=0.2.0
pkgrel=2

pkgdesc="Prometheus instrumentation library for Python applications"
url="https://github.com/prometheus/client_python"
arch=('any')
license=('APACHE')

makedepends=('python' 'python-setuptools'
             'python2' 'python2-setuptools')
checkdepends=('python-twisted' 'python2-twisted')

source=(client_python-$pkgver.tar.gz::https://github.com/prometheus/client_python/archive/v${pkgver}.tar.gz)
sha512sums=('7336d8294ef91dfebe91f325a882105cdaf947de212bff651d1c3ebfc139d9045b7f637ea44b18e921a9f2ad9af554aee28587e57b1202b5a30c49b1a765ba4c')

prepare() {
  cp -r client_python-$pkgver client_python-$pkgver-py2
}

build() {
  cd client_python-$pkgver
  python setup.py build

  cd "$srcdir"/client_python-$pkgver-py2
  python2 setup.py build
}

check() {
  cd client_python-$pkgver
  python setup.py test

  cd "$srcdir"/client_python-$pkgver-py2
  python2 setup.py test
}

package_python-prometheus_client() {
  depends=('python')

  cd client_python-$pkgver
  python setup.py install --root="$pkgdir" --skip-build --optimize=1
}

package_python2-prometheus_client() {
  depends=('python2')

  cd client_python-$pkgver
  python2 setup.py install --root="$pkgdir" --skip-build --optimize=1
}
